package com.xueyi.aixihu.entity.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.xueyi.aixihu.status.FinanceStatus;
import lombok.Data;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 描述 财务审核的Vo
 *
 * @auther 俞烨
 * @date 2022-08-17 14
 */
@Data
public class FinanceAuditVo {

    private Integer id;
    private String photo;
    private String areaName;
    private String financeTitle;
    private BigDecimal borrowTotalMoney;
    private BigDecimal loanTotalMoney;
    private Integer currentStatus;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date lastUpdateTime;
    private String currentStatusStr;
    private Integer isPublic;
    private Integer areaType;
    @JsonFormat(pattern = "yyyy-MM-dd")
    private Date createTime;

    private Integer financeStatus;
    private String financeStatusStr;


    public static Integer getFinalStatus(Integer currentStatus) {
        return (currentStatus == FinanceStatus.ONE_AUDIT.type || currentStatus == FinanceStatus.TWO_AUDIT.type || currentStatus == FinanceStatus.THREE_AUDIT.type)
                ? 2 : (currentStatus == FinanceStatus.TURN_ONE.type || currentStatus == FinanceStatus.TURN_TWO.type || currentStatus == FinanceStatus.TURN_ZERO.type) ?
                3 : (currentStatus == FinanceStatus.PASS_AUDIT.type) ? 1 : currentStatus == FinanceStatus.CAO_GAO.type ? 4 : 0;
    }


    public static String financeStatusStr(Integer financeStatus) {
        switch (financeStatus) {
            case 1:
                return "已通过";
            case 2:
                return "审核中";
            case 3:
                return "已驳回";
            case 4:
                return "草稿箱";
            default:
                return "查询中";
        }
    }

}
